<!DOCTYPE html>
<html lang="en">

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <style>
        .heading td {
            background: #1D9FDF;
            color: white;
            text-align: center;
            border: none;
        }

        #heading {
            text-align: center;
        }


        table {
            border-collapse: collapse;
        }

        td {
            border: 1px solid black;
            height: 30px;
            width: 280px;
            text-align: center;
            font-weight: bold;
        }

        .noBorder td {
            border: none;
            background: lightgray;
        }

        table thead {
            background: gray;
        }

        .reporttable {
            border-collapse: collapse;
        }
    </style>


    <script>
	
	 $("#export").click(function (e) {
                e.preventDefault();

                //getting data from our table
                var data_type = 'data:application/vnd.ms-excel';
                var table_div = document.getElementById('report_table');
                var table_html = table_div.outerHTML.replace(/ /g, '%20');

                var a = document.createElement('a');
                a.href = data_type + ', ' + table_html;
                a.download = 'RP Report.xls';
                a.click();
            });
        var json = "";
        var checkOuLevel = function (ou) {
            $.ajax({
                async: false,
                type: "GET",
                url: "../api/organisationUnits/" + ou + ".json",
                success: function (data) {
                    json = data;

                }
            });
            return json;
        };
		 var getDistrict = function (pid) {
             
						 $.ajax({
                            async: false,
                            type: "GET",
                            url: "../api/organisationUnits/" +pid+ ".json?fields=*&paging=false",
							 success: function (data) {
							
							
							   l= data.name;
							  console.log(l);
							  
                           
                            
                            
						
						}
						});
						return l;
						
						}
		
		
		
		
		
		
		
		
		
		
		

        var checkDataset = function (ou) {
            var count = 0;
            $.ajax({
                async: false,
                type: "GET",
                url: "../api/organisationUnits/" + ou + ".json",
                success: function (data) {
                    //     json = data;


                    for (var p = 0; p < data.dataSets.length; p++) {
                        if (data.dataSets[p].id === "PFHKrQJxO85") {
                            count = 1;
                        }
                    }
                }
            });
            if (count == 1) { return 1; }
            else { return 0; }
            //     return 0;
        };
		
		 var getPeriodArray = function (pe, ouPe) {
            var array = "";
            pe = parseInt(pe);

            while (pe != 201700) {
                array = array + pe + ";";
                pe -= 1;
            }
            array = array + ouPe;
            return array;
        };
        var month;
        var getMonth = function (a) {
            if (a == "1" || a == "01") { month = "January" }
            if (a == "2" || a == "02") { month = "February" }
            if (a == "3" || a == "03") { month = "March" }
            if (a == "4" || a == "04") { month = "April" }
            if (a == "5" || a == "05") { month = "May" }
            if (a == "6" || a == "06") { month = "June" }
            if (a == "7" || a == "07") { month = "July" }
            if (a == "8" || a == "08") { month = "August" }
            if (a == "9" || a == "09") { month = "September" }
            if (a == "10") { month = "october" }
            if (a == "11") { month = "November" }
            if (a == "12") { month = "December" }
        };

        $(document).ready(function () {
		var l;
            var url = window.location.href;
            var pe1 = url.split("&")[1];
            var pe = pe1.split("=")[1];
            var monthCode = pe.substr(4, 6);
            year = pe.substr(0, 4)
			var year = pe.substr(0, 4);
            var ou1 = url.split("&")[2];
            var ou = ou1.split("=")[1];
            var ouLeveldata = checkOuLevel(ou);
            var ouLevel = ouLeveldata.level;
            var index = 1;
			var periodArray = getPeriodArray(pe);

            var printData = function (ou, i, array) {


            var mtrow1 = "", mtrow2 = "", mtrow3 = "", mtrow4 = "", mtrow5 = "", mtrow6 = "", mtrow7 = "", mtrow8 = "", mtrow9 = "", mtrow10 = "", mtrow11 = "", mtrow12 = "", mtrow13 = "", mtrow14 = "", mtrow15 = "", mtrow16 = "" , mtrow17 = "", mtrow18 = "", mtrow19 = "", mtrow20 = "" , mtrow21 = "", mtrow22='',mtrow23='';
          
            var rtrow1 = "", rtrow2 = "", rtrow3 = "", rtrow4 = "", rtrow5 = "", rtrow6 = "", rtrow7 = "", rtrow8 = "", rtrow9 = "", rtrow10 = "", rtrow11 = "", rtrow12 = "", rtrow13 = "", rtrow14 = "", rtrow15 = "", rtrow16 = "" , rtrow17 = "", rtrow18 = "", rtrow19 = "", rtrow20 = "", rtrow21 = "", rtrow22 = '', rtrow23 = '';

            var msrow1 = "", msrow2 = "", msrow3 = "", msrow4 = "", msrow5 = "", msrow6 = "", msrow7 = "", msrow8 = "", msrow9 = "", msrow10 = "", msrow11 = "", msrow12 = "", msrow13 = "", msrow14 = "", msrow15 = "", msrow16 = "", msrow17 = "" , msrow18 = "" , msrow19 = "" , msrow20 = "" , msrow21 = "", msrow22='', msrow23='';
			
			var rsrow1 = "", rsrow2 = "", rsrow3 = "", rsrow4 = "", rsrow5 = "", rsrow6 = "", rsrow7 = "", rsrow8 = "", rsrow9 = "", rsrow10 = "", rsrow11 = "", rsrow12 = "", rsrow13 = "", rsrow14 = "", rsrow15 = "", rsrow16 = "" ,rsrow17 = "", rsrow18 = "", rsrow19 = "", rsrow20 = "", rsrow21 = "" , rsrow22= '', rsrow23 = '';
           
		    var ctrow1 = "", ctrow2 = "", ctrow3 = "", ctrow4 = "", ctrow5 = "", ctrow6 = "", ctrow7 = "", ctrow8 = "", ctrow9 = "", ctrow10 = "", ctrow11 = "", ctrow12 = "", ctrow13 = "", ctrow14 = "", ctrow15 = "", ctrow16 = "", ctrow17 = "", ctrow18 = "", ctrow19 = "" , ctrow20 = "" ,ctrow21 = "" , ctrow22 = '' , ctrow23 = '';
			
			  var csrow1 = "", csrow2 = "", csrow3 = "", csrow4 = "", csrow5 = "", csrow6 = "", csrow7 = "", csrow8 = "", csrow9 = "", csrow10 = "", csrow11 = "", csrow12 = "", csrow13 = "", csrow14 = "", csrow15 = "", csrow16 = "", csrow17 = "", csrow18 ="", csrow19 = "", csrow20 = "", csrow21 = "", csrow22 = "", csrow23 = "";

            var t1 = "", t2 = "", t3 = "", t4 = "", t5 = "", t6 = "", t7 = "", t8 = "", t9 = "", t10 = "", t11 = "", t12 = "", t13 = "", t14 = "", t15 = "", t16 = "", t17 = "", t18 = "", t19 = "", t20 = "", t21 = "", t22 = '' , t23 = '' ;
			
			var mt1="", mt2 = "", mt3 = "", mt4 = "", mt5= "", mt6 = "";
			
                $.ajax({
                    async: false,
                    type: "GET",
					
					url: "../api/26/analytics.json?dimension=pe:" + pe + "&dimension=dx:QAlYbb0VSMQ.KkBuqyBndJs;QAlYbb0VSMQ.B5TjD2oe0TW;FcCvaP21w0G.KkBuqyBndJs;FcCvaP21w0G.B5TjD2oe0TW;PKDPGdOxvE8.KkBuqyBndJs;PKDPGdOxvE8.B5TjD2oe0TW;g7viw3WBFRl.B5TjD2oe0TW;g7viw3WBFRl.KkBuqyBndJs;AS7WdOkID7F.B5TjD2oe0TW;AS7WdOkID7F.KkBuqyBndJs;oFsmmydJgkH.B5TjD2oe0TW;oFsmmydJgkH.KkBuqyBndJs;BUhUJs3z6Px.B5TjD2oe0TW;jwkvfBgsmiM.B5TjD2oe0TW;jwkvfBgsmiM.KkBuqyBndJs;FcCvaP21w0G.B5TjD2oe0TW;FcCvaP21w0G.KkBuqyBndJs;IGatLRbbL2W.B5TjD2oe0TW;IGatLRbbL2W.KkBuqyBndJs;BUhUJs3z6Px.KkBuqyBndJs;hQnARc7iPmR.B5TjD2oe0TW;hQnARc7iPmR.KkBuqyBndJs;YI3R3Dck9HB;hzTlwx7EhWF;vPUAaUlvS1M;IiDBbULvg3G;TBCjtaiHBqK;RA7iir4zOiJ;CCa40u3GLSx;TbIp49cVqYr;yaABmQlXOQM;WrFuaBZlbcu;mtMvov3DWvp;Ow5wtNTGhnM;zXbYtr54aaT;BFal4PBkWXA;STIcCBhfwaG;cqZJahCUfln;R6wbsZlzIBE;qy6Z8LV1WeF;vhGxO9Pm7dX;NlJBJ6UtjG1;q7UpVdig6ly;Ozo12mP2yoS;AcM0nxtNT4u;xaFdKCjQzE0;JGc7tgFbGye;QtmYLif9ol4;QAlYbb0VSMQ;OUSiUXog5Vj;vUPI176AxLt;OoscqBOa8xY;eL43wHdQa7c;m3CJ4D1oPJo;xcmrsyoNzsc;Pe1IMXkF2tA;k6ZoKnqnNrt;G92mhCQpFSH;gd1LESkR9Aa;x2W3haN1Mj6;bQJqsldXna1;jwkvfBgsmiM;OAoa2vN3vMl;isvTIME3vmb;EwzeQxqiCbE;NbSCfjbNKjC;zsgfRjx2UTW;KAXXpaZavXe;b1O5VJtAiSC;PKDPGdOxvE8;aVk2ZH8ebDK;pelrSZaTh4k;WB3SsmBEg8N;nhd3aKtxB7F;GkHtg0DpRBJ;wxBSq18lYe9;QT9GAD9tf32;qioSm8DAekW;XuYCc7LWU8W;A6ONDBa0kZW;uJxnOIeJhBG;s8p4ZuDoLNu;BUhUJs3z6Px;P9S65tXmrXS;EvPj4X2Sl7n;sNt9IzHROTO;jQ2IKo2CbfI;OqkTrJKzD68;szjET2PdZYG;TFtDkQr6blv;AS7WdOkID7F;j9Z9c1C1Ibv;M7DNXPz3aX5;IGatLRbbL2W;g7viw3WBFRl;GSU8Ma71giT;rVzmzLltHnD;G1EogyI286X;iwnrl8poaxi;sfWyngfKfAn;AWLROdfrL9x;TXbUHZCnnLt;RE0TaSM73rz;q88dRsOVEKJ;IDgatoYYYeS;OvtD1XSsMfU;aRY8MOd2Itq;gHMWEVUdbzK;KbNt0wGlikE;HFTzgCJLk0y;uDgXNuVeDgi;g0W8xM7rhKn;FgttzkIT0YP;OndtOI0jVNQ;UvJXUr8resU;Hm0zbyxfRb9;fPCQVFpU4DA;Q1UFxGtmfXQ;b1MXanI7NFd;iLfsMRcxhSh;E7xwxayHFqC;JfXbrUzyoLf;MBpiKJodLtX;KvTIHAEgqq7;lIeXqfQKdQH;hQnARc7iPmR;g5qzZt1GZxX;Hl6uEmeSKoC;RO44GVw2ODe;b0qrmKYl3b3;Mi90TZW4l6i;cgjeoGqyCdy;wk7zV94hpsr;oFsmmydJgkH;q8Ro0SV4tVa;AXdxqeAjauw&filter=ou:" + ou + "&displayProperty=SHORTNAME&outputIdScheme=NAME",

                    success: function (data) {
                        for (var i = 0; i < data.rows.length; i++) {
						
						//total table 1
						
						if (data.rows[i][0] == "RP_Direct cost of approved RP") {
                                mt1 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Direct cost of approved RP_HHs" ) {
                                mt2 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Direct cost of approved RP_Plots" ) {
                                mt3 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Revised cost (if any)") {
                                mt4 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Revised cost (if any)_HHs" ) {
                                mt5 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Revised cost (if any)_Plots") {
                                mt6 = parseInt(data.rows[i][2]);
								
								}
						
						
						
						
						
						
						
						

                         
							//target

                            if (data.rows[i][0] == "RP_Land (excluding absentee land cost) (target)") {
                                mtrow1 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private structures (target)") {
                                mtrow2 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Public structures (target)") {
                                mtrow3 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private trees (target)") {
                                mtrow4 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Community forest trees (target)") {
                                mtrow5 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Fruit trees (target)") {
                                mtrow6 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Standing crops (target)") {
                                mtrow7 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Cost of Absentee owner  (target)") {
                                mtrow8 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Assistence cost for deed transfer (target)") {
                                mtrow9 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer HHs (target)") {
                                mtrow10 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer Plots (target)") {
                                mtrow11 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee HHs (target)" ) {
                                mtrow12 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee Plots (target)") {
                                mtrow13 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] =="RP_Private structures_Affected (target)" ) {
                                mtrow14 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Public structures_Affected (target)") {
                                mtrow15 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] =="RP_Private trees_Affected (target)") {
                                mtrow16 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Community forest trees_Affected (target)") {
                                mtrow17 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Fruit trees_Affected (target)") {
                                mtrow18 = parseInt(data.rows[i][2]);
                            }
							 if (data.rows[i][0] == "RP_Standing crops HHs (target)") {
                                mtrow19 = parseInt(data.rows[i][2]);
                            }
							//yes 
							 if (data.rows[i][0] == "RP_Social safeguard desk establishment_Revised.Yes") {
                                mtrow20 = parseInt(data.rows[i][2]);
								}
							//no
							 if (data.rows[i][0] == "RP_Social safeguard desk establishment (target).No") {
                                mtrow21 = parseInt(data.rows[i][2]);
                            }
							//yes
							 if (data.rows[i][0] =="RP_GRM established or not (target).Yes") {
                                mtrow22 = parseInt(data.rows[i][2]);
                            }
							//no
							 if (data.rows[i][0] =="RP_GRM established or not (target).No") {
                                mtrow23 = parseInt(data.rows[i][2]);
                            }
							
                       //revised

                            if (data.rows[i][0] == "RP_Land (excluding absentee land cost)_Revised") {
                                rtrow1 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private structures_Revised") {
                                rtrow2 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Public structures_Revised") {
                                rtrow3 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private trees_Revised") {
                                rtrow4 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Community forest trees_Revised") {
                                rtrow5 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Fruit trees_Revised") {
                                rtrow6 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] =="RP_Standing crops_Revised" ) {
                                rtrow7 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Cost of Absentee owner _Revised") {
                                rtrow8 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Assistence cost for deed transfer_Revised" ) {
                                rtrow9 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer HHs_Revised" ) {
                                rtrow10 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] =="RP_Deed transfer Plots_Revised" ) {
                                rtrow11 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee HHs_Revised" ) {
                                rtrow12 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee Plots_Revised") {
                                rtrow13 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private structures_Affected_Revised") {
                                rtrow14 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Public structures_Affected_Revised") {
                                rtrow15 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private trees_Affected_Revised") {
                                rtrow16 = parseInt(data.rows[i][2]);
                            }
							 if (data.rows[i][0] == "RP_Community forest trees_Affected_Revised") {
                                rtrow17 = parseInt(data.rows[i][2]);
                            }
							 if (data.rows[i][0] == "RP_Fruit trees_Affected_Revised") {
                                rtrow18 = parseInt(data.rows[i][2]);
                            }
							 if (data.rows[i][0] ==  "RP_Standing crops HHs_Revised") {
                                rtrow19 = parseInt(data.rows[i][2]);
                            }
							 if (data.rows[i][0] == "RP_Social safeguard desk establishment_Revised.Yes") {
                                rtrow20 = parseInt(data.rows[i][2]);
								
                            }
							if (data.rows[i][0] == "RP_Social safeguard desk establishment_Revised.No") {
                                rtrow21 = parseInt(data.rows[i][2]);
                            }
							
							if (data.rows[i][0] == "RP_GRM established or not_Revised.Yes" ) {
                                rtrow22 = parseInt(data.rows[i][2]);
								
                            }
							if (data.rows[i][0] == "RP_GRM established or not_Revised.No") {
                                rtrow23 = parseInt(data.rows[i][2]);
                            }
							

                     //updated

                            if (data.rows[i][0] == "RP_Land (excluding absentee land cost)_Updated") {
                                msrow1 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private structures_Updated") {
                                msrow2 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Public structures_Updated" ) {
                                msrow3 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private trees_Updated") {
                                msrow4 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Community forest trees_Updated") {
                                msrow5 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Fruit trees_Updated") {
                                msrow6 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Standing crops_Updated") {
                                msrow7 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Cost of Absentee owner _Updated") {
                                msrow8 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] =="RP_Assistence cost for deed transfer_Updated" ) {
                                msrow9 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer HHs_Updated") {
                                msrow10 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer Plots_Updated") {
                                msrow11 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee HHs_Updated") {
                                msrow12 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Absentee Plots_Updated") {
                                msrow13 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private structures_Affected_Updated") {
                                msrow14 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Public structures_Affected_Updated") {
                                msrow15 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] ==  "RP_Private trees_Affected_Updated") {
                                msrow16 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Community forest trees_Affected_Updated") {
                                msrow17 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Fruit trees_Affected_Updated") {
                                msrow18 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Standing crops HHs_Updated") {
                                msrow19 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Social safeguard desk establishment_Updated.Yes") {
                                msrow20 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Social safeguard desk establishment_Updated.No") {
                                msrow21 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_GRM established or not_Updated.Yes") {
                                msrow22 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_GRM established or not_Updated.No") {
                                msrow23 = parseInt(data.rows[i][2]);
                            }
							//progress

                            if (data.rows[i][0] == "RP_Land (excluding absentee land cost)_Progress") {
                                rsrow1 = parseInt(data.rows[i][2]);
								
                            }
                            if (data.rows[i][0] == "RP_Private structures_Progress") {
                                rsrow2 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Public structures_Progress" ) {
                                rsrow3 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private trees_Progress") {
                                rsrow4 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Community forest trees_Progress" ) {
                                rsrow5 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Fruit trees_Progress") {
                                rsrow6 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Standing crops_Progress") {
                                rsrow7 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] =="RP_Cost of Absentee owner _Progress" ) {
                                rsrow8 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Assistence cost for deed transfer_Progress" ) {
                                rsrow9 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer HHs_Progress") {
                                rsrow10 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Deed transfer Plots_Progress") {
                                rsrow11 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee HHs_Progress") {
                                rsrow12 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Absentee Plots_Progress") {
                                rsrow13 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private structures_Affected_Progress") {
                                rsrow14 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Public structures_Affected_Progress" ) {
                                rsrow15 = parseInt(data.rows[i][2]);
                            }
                            if (data.rows[i][0] == "RP_Private trees_Affected_Progress") {
                                rsrow16 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Community forest trees_Affected_Progress") {
                                rsrow17 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Fruit trees_Affected_Progress") {
                                rsrow18 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Standing crops HHs_Progress") {
                                rsrow19 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Social safeguard desk establishment_Progress.Yes") {
                                rsrow20 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_Social safeguard desk establishment_Progress.No") {
                                rsrow21 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_GRM established or not_Progress.Yes") {
                                rsrow22 = parseInt(data.rows[i][2]);
                            }
							if (data.rows[i][0] == "RP_GRM established or not_Progress.No") {
                                rsrow23 = parseInt(data.rows[i][2]);
                            }
							
							//remarks
							 if (data.rows[i][0] == "RP_Land (excluding absentee land cost)_Remark" ) {
                                        csrow1 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] ==  "RP_Private structures_Remark" ) {
                                        csrow2 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] == "RP_Public structures_Remark") {
                                        csrow3 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] == "RP_Private trees_Remark") {
                                        csrow4 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_Community forest trees_Remark" ) {
                                        csrow5 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] == "RP_Fruit trees_Remark") {
                                        csrow6 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_Standing crops_Remark" ) {
                                        csrow7 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] ==  "RP_Cost of Absentee owner_Remark") {
                                        csrow8 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_Assistance cost for deed transfer_Remark" ) {
                                        csrow9 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] == "RP_ Deed transfer HHs_Remark") {
                                        csrow10 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] == "RP_ Deed transfer Plots_Remark") {
                                        csrow11 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_ Absentee HHs_Remark" ) {
                                        csrow12 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_ Absentee Plots_Remark" ) {
                                        csrow13 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_Private structures_Affected_Remark" ) {
                                        csrow14 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] =="RP_Public structures_Affected_Remark" ) {
                                        csrow15 = data.rows[i][2];
                                    }
                                    if (data.rows[i][0] == "RP_Private trees_Affected_Remark") {
                                        csrow16 = data.rows[i][2];
                                    }
									 if (data.rows[i][0] == "RP_Community forest trees_Affected_Remark") {
                                        csrow17 = data.rows[i][2];
                                    }
									 if (data.rows[i][0] == "RP_Fruit trees_Affected_Remark") {
                                        csrow18 = data.rows[i][2];
                                    }
									 if (data.rows[i][0] == "RP_Standing crops HHs_Remark") {
                                        csrow19 = data.rows[i][2];
                                    }
									//yes
									 if (data.rows[i][0] == "RP_Social safeguard desk establishment_Remark.Yes") {
                                        csrow20 = data.rows[i][2];
                                    }
									//no
									if (data.rows[i][0] == "RP_Social safeguard desk establishment_Remark.No") {
                                        csrow21 = data.rows[i][2];
                                    }
									
									//yes
									if (data.rows[i][0] =="RP_GRM established or not_Remark.Yes" ) {
                                        csrow22 = data.rows[i][2];
                                    }
									//no
									 if (data.rows[i][0] == "RP_GRM established or not_Remark.No") {
                                        csrow23 = data.rows[i][2];
                                    }
									
									
									
									
							
							
							
						 }
						 
						 
						 
						 
						 
						 
						  $.ajax({
                            async: false,
                            type: "GET",
                            url: "../api/26/analytics.json?dimension=pe:2015;2016;" + periodArray + "&dimension=dx:PKDPGdOxvE8.KkBuqyBndJs;PKDPGdOxvE8.B5TjD2oe0TW;g7viw3WBFRl.B5TjD2oe0TW;g7viw3WBFRl.KkBuqyBndJs;AS7WdOkID7F.B5TjD2oe0TW;AS7WdOkID7F.KkBuqyBndJs;oFsmmydJgkH.B5TjD2oe0TW;oFsmmydJgkH.KkBuqyBndJs;BUhUJs3z6Px.B5TjD2oe0TW;jwkvfBgsmiM.B5TjD2oe0TW;jwkvfBgsmiM.KkBuqyBndJs;FcCvaP21w0G.B5TjD2oe0TW;FcCvaP21w0G.KkBuqyBndJs;IGatLRbbL2W.B5TjD2oe0TW;IGatLRbbL2W.KkBuqyBndJs;BUhUJs3z6Px.KkBuqyBndJs;hQnARc7iPmR.B5TjD2oe0TW;hQnARc7iPmR.KkBuqyBndJs;YI3R3Dck9HB;hzTlwx7EhWF;vPUAaUlvS1M;IiDBbULvg3G;TBCjtaiHBqK;RA7iir4zOiJ;CCa40u3GLSx;TbIp49cVqYr;yaABmQlXOQM;WrFuaBZlbcu;mtMvov3DWvp;Ow5wtNTGhnM;zXbYtr54aaT;BFal4PBkWXA;STIcCBhfwaG;cqZJahCUfln;R6wbsZlzIBE;qy6Z8LV1WeF;vhGxO9Pm7dX;NlJBJ6UtjG1;q7UpVdig6ly;Ozo12mP2yoS;AcM0nxtNT4u;xaFdKCjQzE0;JGc7tgFbGye;QtmYLif9ol4;QAlYbb0VSMQ;OUSiUXog5Vj;vUPI176AxLt;OoscqBOa8xY;eL43wHdQa7c;m3CJ4D1oPJo;xcmrsyoNzsc;Pe1IMXkF2tA;k6ZoKnqnNrt;G92mhCQpFSH;gd1LESkR9Aa;x2W3haN1Mj6;bQJqsldXna1;jwkvfBgsmiM;OAoa2vN3vMl;isvTIME3vmb;EwzeQxqiCbE;NbSCfjbNKjC;zsgfRjx2UTW;KAXXpaZavXe;b1O5VJtAiSC;PKDPGdOxvE8;aVk2ZH8ebDK;pelrSZaTh4k;WB3SsmBEg8N;nhd3aKtxB7F;GkHtg0DpRBJ;wxBSq18lYe9;QT9GAD9tf32;qioSm8DAekW;XuYCc7LWU8W;A6ONDBa0kZW;uJxnOIeJhBG;s8p4ZuDoLNu;BUhUJs3z6Px;P9S65tXmrXS;EvPj4X2Sl7n;sNt9IzHROTO;jQ2IKo2CbfI;OqkTrJKzD68;szjET2PdZYG;TFtDkQr6blv;AS7WdOkID7F;j9Z9c1C1Ibv;M7DNXPz3aX5;IGatLRbbL2W;g7viw3WBFRl;GSU8Ma71giT;rVzmzLltHnD;G1EogyI286X;iwnrl8poaxi;sfWyngfKfAn;AWLROdfrL9x;TXbUHZCnnLt;RE0TaSM73rz;q88dRsOVEKJ;IDgatoYYYeS;OvtD1XSsMfU;aRY8MOd2Itq;gHMWEVUdbzK;KbNt0wGlikE;HFTzgCJLk0y;uDgXNuVeDgi;g0W8xM7rhKn;FgttzkIT0YP;OndtOI0jVNQ;UvJXUr8resU;Hm0zbyxfRb9;fPCQVFpU4DA;Q1UFxGtmfXQ;b1MXanI7NFd;iLfsMRcxhSh;E7xwxayHFqC;JfXbrUzyoLf;MBpiKJodLtX;KvTIHAEgqq7;lIeXqfQKdQH;hQnARc7iPmR;g5qzZt1GZxX;Hl6uEmeSKoC;RO44GVw2ODe;b0qrmKYl3b3;Mi90TZW4l6i;cgjeoGqyCdy;wk7zV94hpsr;oFsmmydJgkH;q8Ro0SV4tVa;AXdxqeAjauw&filter=ou:" + ou + "&displayProperty=SHORTNAME&outputIdScheme=NAME",
                            success: function (data) {
                               for (var i = 0; i < data.rows.length; i++) {
								 
								 if (data.rows[i][0] == "RP_Land (excluding absentee land cost)_Progress" ) {
                                        ctrow1 += parseInt(data.rows[i][2]);
									
										
                                    }
                                    if (data.rows[i][0] =="RP_Private structures_Progress" ) {
                                        ctrow2 += parseInt(data.rows[i][2]);
                                    }
                                   if (data.rows[i][0] == "RP_Public structures_Progress" ) {
                                        ctrow3 += parseInt(data.rows[i][2]);
                                    }
                                   if (data.rows[i][0] == "RP_Private trees_Progress") {
                                        ctrow4 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Community forest trees_Progress" ) {
                                        ctrow5 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Fruit trees_Progress") {
                                        ctrow6 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Standing crops_Progress") {
                                        ctrow7 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] =="RP_Cost of Absentee owner _Progress" ) {
                                        ctrow8 += parseInt(data.rows[i][2]);
                                    }
                                   if (data.rows[i][0] == "RP_Assistence cost for deed transfer_Progress" ) {
                                        ctrow9 += parseInt(data.rows[i][2]);
                                    }
                                     if (data.rows[i][0] == "RP_Deed transfer HHs_Progress") {
                                        ctrow10 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Deed transfer Plots_Progress") {
                                        ctrow11 += parseInt(data.rows[i][2]);
                                    }
                                     if (data.rows[i][0] == "RP_Absentee HHs_Progress") {
                                        ctrow12 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Absentee Plots_Progress") {
                                        ctrow13 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] ==  "RP_Private structures_Affected_Progress") {
                                        ctrow14 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Public structures_Affected_Progress" ) {
                                        ctrow15 += parseInt(data.rows[i][2]);
                                    }
                                    if (data.rows[i][0] == "RP_Private trees_Affected_Progress") {
                                        ctrow16 += parseInt(data.rows[i][2]);
                                    }
									 if (data.rows[i][0] ==  "RP_Community forest trees_Affected_Progress") {
                                        ctrow17 += parseInt(data.rows[i][2]);
                                    }
									 if (data.rows[i][0] == "RP_Fruit trees_Affected_Progress") {
                                        ctrow18 += parseInt(data.rows[i][2]);
                                    }
									if (data.rows[i][0] == "RP_Standing crops HHs_Progress") {
                                        ctrow19 += parseInt(data.rows[i][2]);
                                    }
									 if (data.rows[i][0] == "RP_Social safeguard desk establishment_Progress.Yes") {
                                        ctrow20 += parseInt(data.rows[i][2]);
                                    }
									 if (data.rows[i][0] == "RP_Social safeguard desk establishment_Progress.No") {
                                        ctrow21 += parseInt(data.rows[i][2]);
                                    }
									if (data.rows[i][0] == "RP_GRM established or not_Progress.Yes") {
                                        ctrow22 += parseInt(data.rows[i][2]);
                                    }
									 if (data.rows[i][0] == "RP_GRM established or not_Progress.No") {
                                        ctrow23 += parseInt(data.rows[i][2]);
                                    }
									
									
									
									
									
									
                            }
							}
							
                        });
                    }
                });
				
				var t1=parseInt(rsrow1) + parseInt(ctrow1);
				var t2=parseInt(rsrow2) + parseInt(ctrow2);
				var t3=parseInt(rsrow3) + parseInt(ctrow3);
				var t4=parseInt(rsrow4) + parseInt(ctrow4);
				var t5=parseInt(rsrow5) + parseInt(ctrow5);
				var t6=parseInt(rsrow6) + parseInt(ctrow6);
				var t7=parseInt(rsrow7) + parseInt(ctrow7);
				var t8=parseInt(rsrow8) + parseInt(ctrow8);
				var t9=parseInt(rsrow9) + parseInt(ctrow9);
				var t10=parseInt(rsrow10) + parseInt(ctrow10);
				var t11=parseInt(rsrow11) + parseInt(ctrow11);
				var t12=parseInt(rsrow12) + parseInt(ctrow12);
				var t13=parseInt(rsrow13) + parseInt(ctrow13);
				var t14=parseInt(rsrow14) + parseInt(ctrow14);
				var t15=parseInt(rsrow15) + parseInt(ctrow15);
				var t16=parseInt(rsrow16) + parseInt(ctrow16);
				var t17=parseInt(rsrow17) + parseInt(ctrow17);
				var t18=parseInt(rsrow18) + parseInt(ctrow18);
				var t19=parseInt(rsrow19) + parseInt(ctrow19);
				var t20=parseInt(rsrow20) + parseInt(ctrow20);
				var t21=parseInt(rsrow21) + parseInt(ctrow21);
				var t22=parseInt(rsrow22) + parseInt(ctrow22);
				var t23=parseInt(rsrow23) + parseInt(ctrow23);
				
				
				
									

						 
						 
						 
                        var row = "";
                        var getName = checkOuLevel(ou);
                        var ouname = getName.name;
						var parId=getName.parent;
						var pid=parId.id;
						 var districtt = getDistrict(pid);
						
						
						
                        var table = "<table class='reporttable_" + i + "' border='1'></table>";
                        $(".tableattach").append(table);
                        //name of ou
                        var row = "<tr bgcolor='#AEB6BF'><td colspan = '2'>District : </td><td colspan='2'>"+ districtt +"</td><td colspan='2'>Project Name :  </td><td colspan =2'>" + ouname + "</td><td colspan= '2'>Periods : "+year+"</td></tr>";
						
						row = row + "<tr><td>Total direct cost of approved RP</td><td> "+mt1+"</td><td>Total HHs</td><td> "+mt2+"</td><td>Total Plots</td> <td>"+mt3+" </td></tr><tr><td>Revised cost if any</td><td> "+mt4+"</td><td> Total HHs</td><td> "+mt5+"</td><td> Total Plots</td><td>"+mt6+" </td></tr><tr><td colspan = '10'></td></tr>";

                        //heading
                        row = row + "<tr><td>S.No.</td><td>Category</td><td>Unit</td><td>RP /Due Diligence Target</td><td>If RP/DDR Revised</td><td>Total Updated cost</td> <td> Progress upto Last Period</td><td>Progress in Reporting Period</td><td>Total</td><td>Remarks</td></tr><tr><td colspan='10',bgcolor='gray'>A*. Compensation Payment:</td></tr>";
						

                        // first row : techincal
                        row = row + "<tr><td>A.1</td><td>Land (excluding absentee land cost)</td><td>NRs.</td><td>" +mtrow1 + "</td><td>" + rtrow1 + "</td><td>" + msrow1+"</td><td>" + ctrow1 + "</td><td>"+ rsrow1 + "</td><td> " + t1 + "</td><td>"+csrow1+"  </td></tr>";
                        row = row + "<tr><td>A.2</td><td>Private structures</td><td>NRs.</td><td>" +mtrow2 + "</td><td>" + rtrow2 + "</td><td>" + msrow2+"</td><td>" + ctrow2 + "</td><td>"+ rsrow2 + "</td><td> " + t2 + "</td><td> "+csrow2+" </td></tr>";
                        row = row + "<tr><td>A.3</td><td>Public structures</td><td>NRs.</td><td>" +mtrow3 + "</td><td>" + rtrow3 + "</td><td>" + msrow3+"</td><td>" + ctrow3 + "</td><td>"+ rsrow3 + "</td><td> " + t3 + "</td><td> "+csrow3+" </td></tr>";
                        row = row + "<tr><td>A.4</td><td>Private trees</td><td>NRs.</td><td>" +mtrow4 + "</td><td>" + rtrow4 + "</td><td>" + msrow4+"</td><td>" + ctrow4 + "</td><td>"+ rsrow4 + "</td><td> " + t4 + "</td><td>"+csrow4+"  </td></tr>";
                        row = row + "<tr><td>A.5</td><td>Community forest trees</td><td>NRs.</td><td>" +mtrow5 + "</td><td>" + rtrow5 + "</td><td>" + msrow5+"</td><td>" + ctrow5 + "</td><td>"+ rsrow5 + "</td><td> " + t5 + "</td><td> "+csrow5 +"</td></tr>";
                        row = row + "<tr><td>A.6</td><td>Fruit trees</td><td>NRs.</td><td>" +mtrow6 + "</td><td>" + rtrow6 + "</td><td>" + msrow6+"</td><td>" + ctrow6 + "</td><td>"+ rsrow6 + "</td><td> " + t6 + "</td><td> "+csrow6+" </td></tr>";
                        row = row + "<tr><td>A.7</td><td>Standing crops</td><td>NRs.</td><td>" +mtrow7 + "</td><td>" + rtrow7 + "</td><td>" + msrow7+"</td><td>" + ctrow7 + "</td><td>"+ rsrow7 + "</td><td> " + t7 + "</td><td> "+csrow7+"</td></tr>";
                        row = row + "<tr><td>A.8</td><td> Total cost of Absentee owner </td><td>NRs.</td><td>" +mtrow8 + "</td><td>" + rtrow8 + "</td><td>" + msrow8+"</td><td>" + ctrow8 + "</td><td>"+ rsrow8 + "</td><td> " + t8 + "</td><td>"+csrow8+"  </td></tr>";
						row = row + "<tr><td colspan ='2'>Total Direct cost of RP </td><td>NRs.</td><td> </td> <td> </td> <td> </td> <td> </td> <td> </td><td> </td><td> </td></tr>";
						
						row = row + "<tr><td>A.9</td><td>Total assistence cost for deed transfer</td><td>NRs.</td><td>" +mtrow9 + "</td><td>" + rtrow9 + "</td><td>" + msrow10+"</td><td>" + ctrow9 + "</td><td>"+ rsrow9 + "</td><td> " + t9 + "</td><td> "+csrow9+" </td></tr>";
						
						row = row + "<tr><td colspan ='10'>B. Number of Affected Assets</tr>";
						
						row = row + "<tr><td>B.1*a</td><td>Total Deed transfer HHs</td><td>NRs.</td><td>" +mtrow10 + "</td><td>" + rtrow10 + "</td><td>" + msrow10+"</td><td>" + ctrow10 + "</td><td>"+ rsrow10 + "</td><td> " + t10 + "</td><td>"+csrow10+" </td></tr>";
						row = row + "<tr><td>B.1*b</td><td>Total Deed transfer Plots</td><td>NRs.</td><td>" +mtrow11 + "</td><td>" + rtrow11 + "</td><td>" + msrow11+"</td><td>" + ctrow11 + "</td><td>"+ rsrow11 + "</td><td> " + t11 + "</td><td>"+csrow11+" </td></tr>";
						row = row + "<tr><td>B.1*c</td><td>Total Absentee HHs</td><td>NRs.</td><td>" +mtrow12 + "</td><td>" + rtrow12 + "</td><td>" + msrow12+"</td><td>" + ctrow12 + "</td><td>"+ rsrow12 + "</td><td> " + t12 + "</td><td> "+csrow12+" </td></tr>";
						row = row + "<tr><td>B.1*d</td><td>Total Absentee Plots</td><td>NRs.</td><td>" +mtrow13 + "</td><td>" + rtrow13 + "</td><td>" + msrow13+"</td><td>" + ctrow13 + "</td><td>"+ rsrow13 + "</td><td> " + t13+ "</td><td> "+csrow13+" </td></tr>";
						row = row + "<tr><td>B.2</td><td>Private structure</td><td>NRs.</td><td>" +mtrow14 + "</td><td>" + rtrow14 + "</td><td>" + msrow14+"</td><td>" + ctrow14 + "</td><td>"+ rsrow14 + "</td><td> " + t14 + "</td><td> "+csrow14+" </td></tr>";
						row = row + "<tr><td>B.3</td><td>Public structures</td><td>NRs.</td><td>" +mtrow15 + "</td><td>" + rtrow15 + "</td><td>" + msrow15+"</td><td>" + ctrow15 + "</td><td>"+ rsrow15 + "</td><td> " + t15 + "</td><td>  "+csrow15+"</td></tr>";
						row = row + "<tr><td>B.4</td><td>Private trees</td><td>NRs.</td><td>" +mtrow16 + "</td><td>" + rtrow16 + "</td><td>" + msrow16+"</td><td>" + ctrow16 + "</td><td>"+ rsrow16 + "</td><td> " + t16 + "</td><td>"+csrow16+" </td></tr>";
						row = row + "<tr><td>B.5</td><td>Community forest trees</td><td>NRs.</td><td>" +mtrow17 + "</td><td>" + rtrow17 + "</td><td>" + msrow17+ "</td><td>" + ctrow17 + "</td><td>"+ rsrow17 + "</td><td> " + t17 + "</td><td>"+csrow17+" </td></tr>";
						row = row + "<tr><td>B.6</td><td>Fruit trees</td><td>NRs.</td><td>" +mtrow18 + "</td><td>" + rtrow18 + "</td><td>" + msrow18+"</td><td>" + ctrow18 + "</td><td>"+ rsrow18 + "</td><td> " + t18 + "</td><td> "+csrow18+"</td></tr>";
						row = row + "<tr><td>B.7</td><td>Standing crops HHs</td><td>NRs.</td><td>" +mtrow19 + "</td><td>" + rtrow19 + "</td><td>" + msrow19+"</td><td>" + ctrow19 + "</td><td>"+ rsrow19+ "</td><td> " + t19 + "</td><td>"+csrow19+" </td></tr>";
						
						row = row + "<tr><td colspan ='10'>C. Institutional arrangement and Other</tr>";
						row = row + "<tr><td rowspan='2'>C.1</td><td rowspan='2'>Social Safeguard Desk Establishment</td><td>yes</td><td>"+mtrow20+" </td> <td>"+rtrow20+" </td><td>"+msrow20+" </td><td>"+ctrow20+" </td><td>"+rsrow20+" </td><td> "+t20+"</td><td> "+csrow20+"</td></tr>";
						
						row = row + "<tr><td>NRs.</td><td>" +mtrow21 + "</td><td>" + rtrow21 + "</td><td>" + msrow21+"</td><td>" + ctrow21 + "</td><td>"+ rsrow21 + "</td><td> " + t21 + "</td><td>"+csrow21+" </td></tr>";
						
						row = row + "<tr><td rowspan='2'>C.2</td><td rowspan='2'>GRM established or not</td><td>yes</td><td>"+mtrow22+" </td><td>"+rtrow22+" </td><td>"+msrow22+" </td><td>"+ctrow22+" </td><td> "+rsrow22+"</td><td>"+t22+" </td><td>"+csrow22+" </td></tr>";
						row = row + "<tr><td>NRs.</td><td>" +mtrow23 + "</td><td>" + rtrow23 + "</td><td>" + msrow23+"</td><td>" + ctrow23 + "</td><td>"+ rsrow23 + "</td><td> " + t23 + "</td><td>"+csrow23+"  </td></tr>";
						
						
						
                       

          
                        $(".reporttable_" + i).append(row);
                    
            };



            if (ouLevel == 1) {
                for (var p = 0; p < ouLeveldata.children.length; p++) {
                    var tempOu = ouLeveldata.children[p].id;
                    var tempOuData = checkOuLevel(tempOu);
                    if (tempOuData.children.length !== 0) {
                        for (var l = 0; l < tempOuData.children.length; l++) {
                            var tempOu2 = tempOuData.children[l].id;
                            //   var tempOuData2 = checkOuLevel(tempOu2);
                            var returnValue = checkDataset(tempOu2);
                            if (returnValue == 1) {
                                printData(tempOu2, index);
                                index++;
                            }
                        }
                    }
                }
            }
            else if (ouLevel == 2) {
                for (var p = 0; p < ouLeveldata.children.length; p++) {
                    var tempOu = ouLeveldata.children[p].id;
                    var returnValue = checkDataset(tempOu);
                    if (returnValue == 1) {
                        printData(tempOu, index);
                        index++;
                    }
                }
            }
            else if (ouLevel == 3) {
                printData(ou, 1);
            }
            else {
                alert("Wrong selection");
                window.history.back();;
            }


        });
    </script>
</head>

<body>
    <div id="body">
	<center><button id="export">Export to Excel</button></center>
        <br>
        <table class="table table-bordered" width="100%">
            <thead>
                <tr class="heading">
					<td colspan="1" rowspan="3">
                        <img src="../dhis-web-commons/security/DRILP_Logo.jpg" width="90%" height="400%">
                    </td>
                    <td colspan="4" rowspan="1">
                        <p style="font-size:16px;">Earthquake Emergency Assistance Project (EEAP)</p>
                    </td>
                    <td colspan="1" rowspan="3"></td>
                </tr>
                <tr class="heading">
                    <td colspan="4" rowspan="1">
                        <p style="font-size:20px;">Rehabilitation and Reconstruction of District Roads</p>
                    </td>
                </tr>
                <tr class="heading">
                    <td colspan="4" rowspan="1">
                        <p style="font-size:16px;">Monthly Project Progress Report (Part-I)</p>
                    </td>
                </tr>
            </thead>
        </table>
        <br>
		<table id="report_table" class="tableattach"></table>
    </div>
</body>

</html>